package com.sure.classsystemserver.classroom.feedback;


import com.sure.classsystemserver.common.CommonService;
import com.sure.classsystemserver.common.CurrentUser;
import com.sure.classsystemserver.common.Result;
import com.sure.classsystemserver.common.TokenUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/classroom/feedback")
public class FeedbackAPI {
    @Resource
    private FeedbackService feedbackService;

    @Resource
    private CommonService commonService;

    @GetMapping("/classroomList")
    public Result addressList(@RequestHeader("Token")String token) {
        CurrentUser currentUser = TokenUtils.getUserInfo(token,commonService);
        String u_id=currentUser.getUserId();
        List<Classroom> classroomList = feedbackService.findClassroomList(u_id);
        return Result.success(classroomList);
    }

    @GetMapping("")
    public Result DataList(FeedbackDto dto) {
        String c_address=dto.getC_address();
        List<FlowNumber> flowNumbers = feedbackService.findFlowNumber(c_address);
        return Result.success(flowNumbers);
    }
}
